home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 2295 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.7 KB

  1. From: Tony_Bateman@msn.com (Tony Bateman)
  2. Subject: Some help with a linker error...
  3. Date: 16 Jan 96 23:16:19 -0800
  4. Message-ID: <00001a81+00008ede@msn.com>
  5. Path: news.msn.com!msn.com
  6. Newsgroups: comp.lang.c++
  7. Organization: The Microsoft Network (msn.com)
  8.  
  9. Can anybody help me on this problem...
  10.  
  11. I have declared a class ACE2 in one module, with an offending 
  12. declaration to the compiler which looks like this:
  13.  
  14. //global variables
  15. extern  int numberOfRules;
  16. extern  fuzzyGaussFunc *pThisFuzzyFunc;
  17. extern  fuzzyGaussFunc *pFuzzyGfunc;
  18. extern  Vector stateVector;
  19.  
  20. void ACE2::UpdatePt()
  21. {
  22.     ptMinus1 = pt;
  23.     pt = 0;
  24.     for (int i=0; i<numberOfRules; i++)       //numberOfRules gives an error    {
  25.         pThisFuzzyFunc = &pFuzzyGfunc[i];   //as does pThisFuzzyFunc and pFuzzyGfunc
  26.         //+other stuff not relevent here... 
  27.     }
  28. }
  29.  
  30. This **compiles** fine, but when the program is displaying the 
  31. message "Linking, pass 2" it fails and displays 3 errors:
  32.  
  33. "Linker Error: Undefined symbol _numberOfRules in module ACE2.CPP"
  34. "Linker Error: Undefined symbol _pThisFuzzyFunc in module ACE2.CPP"
  35. "Linker Error: Undefined symbol _pFuzzyGfunc in module ACE2.CPP"
  36.  
  37.  
  38. the global variables are part of another class ASE, which is defined 
  39. in another module. The relevent parts of the class definition are 
  40. here:
  41.  
  42. class ace2;
  43. #include "fuzclass.h"
  44. class ASE
  45. {
  46. public:
  47.     friend class ace2;
  48.  
  49. protected:
  50.                                                                   
  51.     fuzzyVar noiseParameters[];                                 
  52.     fuzzyGaussFunc *pFuzzyGfunc;                             
  53.     fuzzyGaussFunc *pThisFuzzyFunc;                             
  54.        int numberOfRules;                                
  55. };
  56.  
  57. Any idea why the "_" has been appended to the variables, and what is 
  58. happening?
  59.  
  60. All replies would be greatfully received.
  61.  
  62.     - A struggling C++ programmer who wishes he's stayed at home with 
  63. Visual Basic!
  64.